#ifndef	__cmdline_h__
#define	__cmdline_h__

#include <cstdio>
#include <iostream>
#include <vector>
#include <utility>
#include <string>

enum E_COMMANDLINE_PARAMETERS
{
	CMD_PARAM_SCENE	=	0,
	CMD_PARAM_WIDTH,
	CMD_PARAM_HEIGHT,
	CMD_PARAM_TRACEDEPTH,
	CMD_PARAM_OUTPUT,
	CMD_PARAM_THREADS,
	CMD_PARAM_GUIMODE,

	NUM_CMD_PARAMS
};

static const int	k_NumCommandLineParameters	=	NUM_CMD_PARAMS;

typedef struct _SCommandLineParameterTemplate
{
	const char*	name;
	bool		needData;
	size_t		nameLen;
} SCommandLineParameterTemplate;

static SCommandLineParameterTemplate s_KnownCommandLineParameters[k_NumCommandLineParameters] = {
	{ "-s",					true,	2 },
	{ "-w",					true,	2 },
	{ "-h",					true,	2 },
	{ "-d",					true,	2 },
	{ "-o",					true,	2 },
	{ "-t",					true,	2 },
	{ "-gui",				false,	4 },
};



typedef std::pair<int, std::string>	TCmdParameter;
typedef std::vector<TCmdParameter>	TCmdParametersVec;

class CommandLine
{
public:
	static void		PrintUsage(void);

public:
	CommandLine();
	virtual ~CommandLine();

	int					ParseArgv(int argc, char** argv);
	int					GetParameterIdx(int paramType) const;
	int					GetParameterType(int idx) const;
	const std::string&	GetParameterData(int idx) const;

private:
	int		FindParameter(const char* arg) const;
	bool	CheckParameter(const char* paramArg, int paramType) const;

private:
	TCmdParametersVec		m_Parameters;
};

#endif	// __cmdline_h__
